#!/usr/bin/perl
# $Id$
#
# Description: Weather Info for screen sessions
#
# Copyright (C) 2003,2004,2005,2006 Charles Mauch <cmauch@gmail.com>
#
# Verbatim copying, distribution, and display of this program is permitted in
# any medium, provided this notice is preserved. Alternatively, you may create
# derivative works of any sort for any purpose, provided your versions contain
# no attribution to me, and that you assert your own authorship (and not mine)
# in every practical medium.

# Possible arguments  rvalues
# place
# temperature_celsius
# temperature_fahrenheit
# humidity
# conditions
# wind_direction
# wind_milesperhour
# wind_kilometersperhour
# pressure
# updated
# clouds
# dewpoint_celsius
# dewpoint_fahrenheit
# moonphase
# moonrise
# moonset
# sunrise
# sunset
# visibility_miles
# visibility_kilometers

use Weather::Underground;

$weather = Weather::Underground->new( place         => "98444",
                                      debug         => 0,
                                      cache_file    => "/tmp/weather.cache",
                                      cache_max_age => 500
                                    ) || die "Error, could not create new weather object: $@\n";

$arrayref = $weather->get_weather()
  || die "Error, calling get_weather() failed: $@\n";

print
  "$arrayref->[0]->{temperature_fahrenheit}F $arrayref->[0]->{conditions}, Wind $arrayref->[0]->{wind_direction} at $arrayref->[0]->{wind_milesperhour}/mph";

